package com.qys.livesMall.shop.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qys.livesMall.shop.modal.entity.ShopOrderSettlementInfo;
import com.qys.livesMall.shop.mapper.ShopOrderSettlementInfoMapper;
import com.qys.livesMall.shop.modal.vo.ShopBalanceVO;
import com.qys.livesMall.shop.service.ShopOrderSettlementInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author
 * @since 2023-07-13
 */
@Service
public class ShopOrderSettlementInfoServiceImpl extends ServiceImpl<ShopOrderSettlementInfoMapper, ShopOrderSettlementInfo> implements ShopOrderSettlementInfoService {

    @Autowired
    private ShopOrderSettlementInfoMapper settlementInfoMapper;

    @Override
    public ShopOrderSettlementInfo getByOrderId(Long orderId) {
        LambdaQueryWrapper<ShopOrderSettlementInfo> wq=new LambdaQueryWrapper<>();
        wq.eq(ShopOrderSettlementInfo::getOrderId,orderId);
        wq.last("limit 1");
        return getOne(wq);
    }

    @Override
    public ShopBalanceVO getShopOrderWaitSettlementInfo(Long shopId) {
        return settlementInfoMapper.getShopOrderWaitSettlementInfo(shopId);
    }

    @Override
    public List<ShopBalanceVO> getShopOrderWaitSettlementInfos(List<Long> shopIds) {
        return settlementInfoMapper.getShopOrderWaitSettlementInfos(shopIds);
    }
}
